"""
@-*- coding: utf-8 -*-
@ python: 3.12.3
@ 创建者: JacksonCode
@ 创建时间: 2024/12/13
"""

import numpy as np

array1 = [1, 2, 3, 4, 5]
# array item element + 1
# print(array + 1)
array = np.array([1, 2, 3, 4, 5])
print(type(array))  # <class 'numpy.ndarray'>
print(array + 1)
print(array.shape)  # (5,)

array2 = np.array([[1, 2, 3], [4, 5, 6]])
print(array2)  # 二维数组

#####  class 2 #####
tang_list = [1, 2, 3, 4, 5]
tang_array = np.array(tang_list)
print(tang_array)
print(type(tang_array))
print(tang_array.dtype)  # int32    float64    <U11
print(tang_array.itemsize)
print(tang_array.shape)
print(tang_array.size)
print(np.shape(tang_array))  #
print(tang_array.ndim)  # 1  一行

tang_array.fill(0)  #
print(tang_array)  # [0 0 0 0 0]

tang_list = [1, 2, 3, 4, 5]
tang_array = np.array(tang_list)
print(tang_array)

print(tang_array[1:3])
print(tang_array[::-1])  # [5 4 3 2 1]
print(tang_array[1::2])
print(tang_array[1::3])
